package Stringdemo;

public class StringDemo11 {
    public static void main(String[] args) {
        String id = "410223199809034575";

        //获取出生年月日
        String year = id.substring(6,10);
        String month = id.substring(10,12);
        String day = id.substring(12,14);
        System.out.println(year+month+day);

        //获取男女性别
        char gender = id.charAt(16);
        int num =  gender - 48;
        System.out.println(num);
        if (num % 2 == 0) {
            System.out.println("性别为女");
        }else {
            System.out.println("性别为男");
        }
    }
}
